package top.yfq.multidatasource.datasource;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author yfq
 * @date 2025/9/27 11:37
 * @description
 */
public abstract class AbstractDataSourceService implements IDataSourceService {
    protected final Map<String, DataSourceInfo> dataSourceInfoMap = new ConcurrentHashMap<>();

    @Override
    public List<DataSourceInfo> dataSourcesInfos() {
        return new ArrayList<>(dataSourceInfoMap.values());
    }

    @Override
    public DataSourceInfo queryByKey(String key) {
        return dataSourceInfoMap.get(key);
    }
}
